package com.mlnx.netty.base.handler;


import com.mlnx.data.entity.CO2Info;
import com.mlnx.netty.base.message.CO2Message;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @author fzh
 * @create 2018/3/20 13:42
 */
public class PushCO2Handle extends SimpleChannelInboundHandler<CO2Message> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, CO2Message msg) throws Exception {
        String deviceId = msg.getDeviceId();

        CO2Info co2Info = new CO2Info();
        co2Info.setDeviceId(deviceId);
        co2Info.setPatientId(msg.getPatientId());
        co2Info.setTime(msg.getPacketTime());

        co2Info.setCo2(msg.getCo2Value());
    }
}
